﻿namespace RayDen.Library.Components.Surface {
    using RayDen.Library.Core.Primitives;
    using RayDen.Library.Entity.Scene;
    
    public class GeometryPointInfo
    {
        public int MaterialId;
        public string MaterialName;
        public string MeshName;
        public Vector Point;
        public Normal GeoNormal, ShadingNormal;
        public UV TexCoord;
    }

    public abstract class MaterialImplementation {
        public MaterialInfo MaterialData;
        protected MaterialImplementation(MaterialInfo data) {
            this.MaterialData = data;
        }
        public abstract Bsdf GetBsdf( GeometryPointInfo hitInfo );
    }


    public class DiffuseMaterial : MaterialImplementation
    {
        public DiffuseMaterial(MaterialInfo data) : base(data)
        {
        }

        public override Bsdf GetBsdf(GeometryPointInfo hitInfo)
        {
            var bsdf = new Bsdf(ref hitInfo.GeoNormal, ref hitInfo.ShadingNormal);
            bsdf.Add(new Lambertian(MaterialData.Kd));
            return bsdf;
        }
    }


    public class UberMaterial : MaterialImplementation
    {
        public UberMaterial(MaterialInfo data) : base(data)
        {
        }

        public override Bsdf GetBsdf(GeometryPointInfo hitInfo)
        {
            throw new System.NotImplementedException();
        }
    }

}
